﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace Win32Import
{
    /// <summary>
    /// Class used to import required Win32 functions
    /// Functions are imorted as static members
    /// </summary>
    class Win32
    {

        [DllImport("user32.dll")]
        public static extern IntPtr CreateWindowEx(
                WS_EX dwExStyle,
                string lpClassName,
                string lpWindowName,
                WS dwStyle,
                int x,
                int y,
                int nWidth,
                int nHeight,
                IntPtr hWndParent,
                IntPtr hMenu,
                IntPtr hInstance,
                IntPtr lpParam
            );

        [DllImport("user32.dll")]
        public static extern IntPtr CreateWindow(
                string lpClassName,
                string lpWindowName,
                WS dwStyle,
                int x,
                int y,
                int nWidth,
                int nHeight,
                IntPtr hWndParent,
                IntPtr hMenu,
                IntPtr hInstance,
                IntPtr lpParam
            );

        [DllImport("user32.dll")]
        public static extern IntPtr SetParent(
                IntPtr hWndChild,
                IntPtr hWndParent
            );

        [DllImport("user32.dll")]
        public static extern bool ShowWindow(
                IntPtr hWnd,
                SW nCmdShow
            );

        [DllImport("user32.dll")]
        public static extern bool PrintWindow(
                IntPtr hwnd,
                IntPtr hdcBlt,
                uint nFlags
            );



        [DllImport("user32.dll")]
        public static extern bool UpdateWindow(
                IntPtr hWnd
            );

        [DllImport("user32.dll")]
        public static extern IntPtr DefWindowProc(
                IntPtr hWnd,
                UInt32 uMsg,
                IntPtr wParam,
                IntPtr lParam
            );

        [DllImport("user32.dll")]
        public static extern bool BringWindowToTop(
                IntPtr hWnd
            );

        [DllImport("user32.dll")]
        public static extern bool SetFocus(
                IntPtr hWnd
            );
        [DllImport("user32.dll")]
        public static extern bool MoveWindow(
                IntPtr hWnd,
                int X,
                int Y,
                int nWidth,
                int nHeight,
                bool bRepaint
            );

        [DllImport("user32.dll")]
        public static extern long SetWindowLong(
                IntPtr hWnd,
                GWL nIndex,
                uint value
            );
        [DllImport("user32.dll")]
        public static extern int EnumWindows(
                EnumWindowsProc lpEnumFunc,
                int lParam
            );

        public delegate bool EnumWindowsProc(
                IntPtr hWnd,
                int lParam
            );

        [DllImport("user32.dll")]
        public static extern int GetWindowThreadProcessId(
                IntPtr hWnd,
                out IntPtr lpdwProcessId
            );

        [DllImport("user32.dll")]
        public static extern IntPtr SetWindowsHookEx(WH hookType, HookProc lpfn, IntPtr hMod, int dwThreadId);

        public delegate int HookProc(
                int code,
                IntPtr wParam,
                IntPtr lParam
            );

    }
}
